this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.Ui=this.BX.Landing.Ui||{};this.BX.Landing.Ui.Panel=this.BX.Landing.Ui.Panel||{};this.BX.Landing.Ui.Panel.Formsettingspanel=this.BX.Landing.Ui.Panel.Formsettingspanel||{};(function(e,t,n,a,i,r,s,o,c,l,g){"use strict";function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){babelHelpers.defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var p=function(e){babelHelpers.inherits(n,e);function n(e){var t;babelHelpers.classCallCheck(this,n);t=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(n).call(this,e));t.setEventNamespace("BX.Landing.UI.Panel.FormSettingsPanel.Whatsapp");t.addItem(t.getHeader());if(t.options.dictionary.whatsapp.setup.completed){t.addItem(t.getSettingsForm())}else{t.addItem(t.getWarningMessage())}return t}babelHelpers.createClass(n,[{key:"getHeader",value:function e(){return this.cache.remember("header",(function(){return new s.HeaderCard({title:a.Loc.getMessage("LANDING_FORM_SETTINGS_WHATSAPP_TITLE")})}))}},{key:"getWarningMessage",value:function e(){var t=this;return this.cache.remember("warningMessage",(function(){return new c.MessageCard({header:a.Loc.getMessage("LANDING_FORM_WHATSAPP_WARNING_HEADER"),description:a.Loc.getMessage("LANDING_FORM_WHATSAPP_WARNING_TEXT"),angle:false,closeable:false,more:function e(){BX.SidePanel.Instance.open(t.options.dictionary.whatsapp.setup.link,{events:{onClose:function e(){l.FormClient.getInstance().getDictionary().then((function(e){t.options.dictionary=e;g.FormSettingsPanel.getInstance().setFormDictionary(e);t.clear();t.addItem(t.getHeader());if(t.options.dictionary.whatsapp.setup.completed){t.addItem(t.getSettingsForm())}else{t.addItem(t.getWarningMessage())}}))}}})}})}))}},{key:"getSettingsForm",value:function e(){var t=this;return this.cache.remember("settingsForm",(function(){return new r.FormSettingsForm({title:a.Loc.getMessage("LANDING_FORM_SETTINGS_WHATSAPP_USE_CHECKBOX_LABEL"),fields:[t.getTextField()]})}))}},{key:"getUseCheckboxField",value:function e(){var n=this;return this.cache.remember("useCheckboxField",(function(){return new BX.Landing.UI.Field.Checkbox({selector:"use",compact:true,value:[t.Text.toBoolean(n.options.formOptions.whatsapp.use)],items:[{name:a.Loc.getMessage("LANDING_FORM_SETTINGS_CALLBACK_USE_CHECKBOX_LABEL"),value:true}]})}))}},{key:"getTextField",value:function e(){var n=this;return this.cache.remember("textField",(function(){var e=n.options.dictionary.whatsapp.messages.find((function(e){return String(e.langId)===String(n.options.data.language)}));var i=t.Type.isPlainObject(e)?e.text:"";var r=new o.TextField({selector:"text",title:a.Loc.getMessage("LANDING_FORM_SETTINGS_WHATSAPP_TEXT_TITLE"),content:i,textOnly:true});t.Dom.addClass(r.input,"landing-ui-disabled");return r}))}},{key:"valueReducer",value:function e(t){return{whatsapp:{use:this.getSettingsForm().isOpened()}}}},{key:"onChange",value:function e(t){this.emit("onChange",u(u({},t.getData()),{},{skipPrepare:true}))}}]);return n}(i.ContentWrapper);e.default=p})(this.BX.Landing.Ui.Panel.Formsettingspanel.Content=this.BX.Landing.Ui.Panel.Formsettingspanel.Content||{},BX,BX.Event,BX.Landing,BX.Landing.UI.Panel,BX.Landing.UI.Form,BX.Landing.UI.Card,BX.Landing.UI.Field,BX.Landing.UI.Card,BX.Crm.Form,BX.Landing.UI.Panel);
//# sourceMappingURL=whatsapp.bundle.map.js